home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Tool Chest / Development Tools & Languages / Dylan Related / Marlais / Marlais 0.5.9-portable sources / gc / gc.man < prev    next >
Encoding:
Text File  |  1995-03-15  |  3.2 KB  |  64 lines  |  [TEXT/ttxt]

  1. .TH GC_MALLOC 1L "20 April 1994"
  2. .SH NAME
  3. GC_malloc, GC_malloc_atomic, GC_free, GC_realloc, GC_enable_incremental, GC_register_finalizer \- Garbage collecting malloc replacement
  4. .SH SYNOPSIS
  5. #include "gc.h"
  6. .br
  7. # define malloc(n) GC_malloc(n)
  8. .br
  9. ... malloc(...) ...
  10. .br
  11. .sp
  12. cc ... gc.a
  13. .LP
  14. .SH DESCRIPTION
  15. .I GC_malloc
  16. and
  17. .I GC_free
  18. are plug-in replacements for standard malloc and free.  However,
  19. .I
  20. GC_malloc
  21. will attempt to reclaim inaccessible space automaticaly by invoking a conservative garbage collector at appropriate points.  The collector traverses all data structures accessible by following pointers from the machines registers, stack(s), data, and bss segments.  Inaccessible structures will be reclaimed.  A machine word is considered to be a valid pointer if it is an address inside an object allocated by
  22. .I
  23. GC_malloc
  24. or friends.
  25. .LP
  26. Unlike the standard implementations of malloc,
  27. .I
  28. GC_malloc
  29. clears the newly allocated storage.
  30. .I
  31. GC_malloc_atomic
  32. does not.  Furthermore, it informs the collector that the resulting object will never contain any pointers, and should therefore not be scanned by the collector.
  33. .I
  34. GC_free
  35. can be used to deallocate objects, but its use is optional, and discouraged.
  36. .I
  37. GC_realloc
  38. has the standard realloc semantics.  It preserves pointer-free-ness.
  39. .I
  40. GC_register_finalizer
  41. allows for registration of functions that are invoked when an object becomes inaccessible.
  42. .LP
  43. It is also possible to use the collector to find storage leaks in programs destined to be run with standard malloc/free.  The collector can be compiled for thread-safe operation.  Unlike standard malloc, it is safe to call malloc after a previous malloc call was interrupted by a signal, provided the original malloc call is not resumed.
  44. .LP
  45. Debugging versions of many of the above routines are provided as macros.  Their names are identical to the above, but consist of all capital letters.  If GC_DEBUG is defined before gc.h is included, these routines do additional checking, and allow the leak detecting version of the collector to produce slightly more useful output.  Without GC_DEBUG defined, they behave exactly like the lower-case versions.
  46. .LP
  47. On some machines, collection will be performed incrementally after a call to
  48. .I
  49. GC_enable_incremental.
  50. This may temporarily write protect pages in the heap.  See the README file for more information on how this interacts with system calls that write to the heap.
  51. .LP
  52. Other facilities not discussed here include a C++ interface, limited facilities to support incremental collection on machines without appropriate VM support, provisions for providing more explicit object layout information to the garbage collector, more direct support for ``weak'' pointers, etc.
  53. .LP
  54. .SH "SEE ALSO"
  55. The README and gc.h files in the distribution.  More detailed definitions of the functions exported by the collector are given there.  (The above list is not complete.)
  56. .LP
  57. Boehm, H., and M. Weiser, "Garbage Collection in an Uncooperative Environment",
  58. \fISoftware Practice & Experience\fP, September 1988, pp. 807-820.
  59. .LP
  60. The malloc(3) man page.
  61. .LP
  62. .SH AUTHOR
  63. Hans-J. Boehm (boehm@parc.xerox.com).  Some of the code was written by others, most notably Alan Demers.
  64.